require("should");

const {
	isString,
	isNumber,
	isFunction,
	isObject,
	isNull,
	isUndefined,
	isEmail,
	isMobile,
	isIdCard,
	isURL,
	isCN,
	isZipCode,
	isIP
} = require("../lib/type/index");

describe("Date", function () {
	it("test isString: isString('test') should be true", function () {
		const result = isString("test");

		result.should.be.ok();
	});

	it("test isNumber: isNumber(20180515111111) should be true", function () {
		const result = isNumber(20180515111111);

		result.should.be.ok();
	});

	it("test isFunction: isFunction(function(){}) should be true", function () {
		const result = isFunction(function () {});

		result.should.be.ok();
	});

	it("test isObject: isObject({}) should be true", function () {
		const result = isObject({});

		result.should.be.ok();
	});

	it("test isNull: isNull(null) should be true", function () {
		const result = isNull(null);

		result.should.be.ok();
	});

	it("test isUndefined: isUndefined(undefined) should be true", function () {
		const result = isUndefined(undefined);

		result.should.be.ok();
	});

	it("test isEmail: isEmail(727909373@qq.com) should be true", function () {
		const result = isEmail("727909373@qq.com");
		result.should.be.ok();
	});

	it("test isMobile: isMobile(15021431294) should be true", function () {
		const result = isMobile("15021431294");
		result.should.be.ok();
	});

	it("test isIdCard: isIdCard(360121199208252934) should be true", function () {
		const result = isIdCard("360121199208252934");
		result.should.be.ok();
	});

	it("test isCN: isCN(中文) should be true", function () {
		const result = isCN("中文");
		result.should.be.ok();
	});

	it("test isZipCode: isZipCode(330029) should be true", function () {
		const result = isZipCode("330029");
		result.should.be.ok();
	});

	it("test isIP: isIP(192.168.0.1) should be true", function () {
		const result = isIP("192.168.0.1");
		result.should.be.ok();
	});

	it("test isURL: isURL(http://www.baidu.com) should be true", function () {
		const result = isURL("http://www.baidu.com");
		result.should.be.ok();
	});
});
